<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
    '<div contenteditable>te|st</div>',
    selection => {
      selection.setClipboardData('foo<style>@import "../resources/all-red.css";</style>'),
      selection.document.execCommand('paste')
    },
    '<div contenteditable>tefoo|st</div>',
    '@import local file is blocked');

selection_test(
    '<div contenteditable>te|st</div>',
    selection => {
      selection.setClipboardData('foo<style>@import "http://localhost:8000/resources/all-red.css";</style>'),
      selection.document.execCommand('paste')
    },
    '<div contenteditable>tefoo|st</div>',
    '@import remote style sheet is blocked');

// *{color:red;}
const dataURL = 'data:text/css;charset=UTF-8,*%7Bcolor%3Ared%3B%7D'
selection_test(
    '<div contenteditable>te|st</div>',
    selection => {
      selection.setClipboardData(`foo<style>@import url(${dataURL});</style>`),
      selection.document.execCommand('paste')
    },
    '<div contenteditable>tefoo|st</div>',
    '@import data URL is blocked');
</script>
